import { createRouter, createWebHistory,RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'

const routes: RouteRecordRaw[] = [
    {
        path: '/',
        component: Layout,
        children: [
            {
                path: '/',
                name: 'Home',
                component: () => import('@/views/Home.vue')
            },
            {
                path: '/news',
                name: 'News',
                component: () => import('@/views/News.vue')
            },
            {
                path:'/detail/:id',
                name: 'Detail',
                component: () => import('@/views/Detail.vue')
            },
            {
                path: '/article/add',
                name: 'Add',
                component: () => import('@/views/article/Add.vue')
            },
            {
                path: '/article/List',
                name: 'List',
                component: () => import('@/views/article/List.vue')
            },
            {
                path: '/product',
                name: 'Product',
                component: () => import('@/views/Product.vue')
            }
        ]
    },
    {
        path: '/login',
        component: () => import('@/views/Login.vue')
    },
    {
        path: '/about',
        component: () => import('@/views/About.vue')
    }
]

export default createRouter({
    history: createWebHistory(),
    routes,
})